package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import static java.lang.System.out;

public class MainActivity extends AppCompatActivity {

    private EditText ed_t1;
    private EditText ed_t2;
    private EditText ed_t3;
    private EditText ed_t4;
    private EditText ed_t5;
    private EditText ed_t6;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

         ed_t1 = findViewById(R.id.userName);
         ed_t2 = findViewById(R.id.name);
         ed_t3 = findViewById(R.id.mailbox);
         ed_t4 = findViewById(R.id.phone);
         ed_t5 = findViewById(R.id.passWord);
         ed_t6 = findViewById(R.id.rePassWord);
    }

    public void edg(View view) {
        String userName = ed_t1.getText().toString();
        String Name = ed_t2.getText().toString();
        String mailbox = ed_t3.getText().toString();
        String phone = ed_t4.getText().toString();
        String passWord = ed_t5.getText().toString();
        String rePassWord = ed_t6.getText().toString();
        if (passWord.equals(rePassWord)&&passWord.length()>0) {
            Toast.makeText(this, "用户名" + userName + ",真实姓名" + Name + ",邮箱" + mailbox +
                    "电话" + phone, Toast.LENGTH_SHORT).show();
        }else if (!passWord.equals(rePassWord)){
            Toast.makeText(this, "输入的两次密码不正确！", Toast.LENGTH_SHORT).show();
        }else{
            Toast.makeText(this, "请将数据输入完整！", Toast.LENGTH_SHORT).show();
        }
        System.out.println("密码为"+passWord);
    }
}